package com.banciyuan.bcywebview.biz.main.group.hot.viewholder;

import android.content.Context;
import android.text.Html;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.banciyuan.bcywebview.R;
import com.banciyuan.bcywebview.biz.main.group.groupselect.GroupSelectActivity;
import com.banciyuan.bcywebview.utils.intent.gotoUtil;

import de.greenrobot.daoexample.model.Team;

/**
 * Created by squall on 2017/6/28.
 */

public class ViewGroupWaitForYou {

    private TextView post;
    private TextView title;
    private View itemView;

    public ViewGroupWaitForYou(View convertView) {
        post = (TextView) convertView.findViewById(R.id.group_post);
        title = (TextView) convertView.findViewById(R.id.group_title);
        itemView = convertView.findViewById(R.id.itemview);

    }

    public void renderData(final Context mContext, Team team) {
        if (!TextUtils.isEmpty(team.getName())) {
            title.setText(Html.fromHtml(team.getName()));
        }
        if (team.getPosts() != null && !team.getPosts().isEmpty()) {
            post.setVisibility(View.VISIBLE);
            post.setText(mContext.getString(R.string.this_group_plain));
        } else {
            post.setVisibility(View.GONE);
        }
        itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                gotoUtil.gotoAct(mContext, GroupSelectActivity.class, 2);
            }
        });
    }

}
